home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performJiggle.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  20.3 KB  |  732 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  18 Dec 2000
  22. //
  23. //  Description:
  24. //      jiggle default options box.  The content for each tab 
  25. //        is not created until it is accessed for the first time.
  26. //
  27. //////////////////////////////////////////////////////////////////////
  28. //
  29. //  Procedure Name:
  30. //      setOptionVars
  31. //
  32. //  Description:
  33. //        Initialize the option values.
  34. //
  35. //  Input Arguments:
  36. //        Whether to set the options to default values.
  37. //
  38. //  Return Value:
  39. //      None.
  40. //
  41. proc setOptionVars(int $forceFactorySettings)
  42. {
  43.     //    stiffness
  44.     //
  45.     if ($forceFactorySettings || !`optionVar -exists jiggleStiffness`) {
  46.         optionVar -floatValue  jiggleStiffness 0.5;
  47.     }
  48.  
  49.     //    damping
  50.     //
  51.     if ($forceFactorySettings || !`optionVar -exists jiggleDamping`) {
  52.         optionVar -floatValue  jiggleDamping 0.5;
  53.     }
  54.  
  55.     // weight
  56.     //
  57.     if ($forceFactorySettings || !`optionVar -exists jiggleWeight`) {
  58.         optionVar -floatValue  jiggleWeight 1.0;
  59.     }
  60.  
  61.     // ignore transform
  62.     //
  63.     if ($forceFactorySettings || !`optionVar -exists jiggleIgnoreTransform`) {
  64.         optionVar -intValue  jiggleIgnoreTransform 0;
  65.     }
  66.  
  67.     // enable only when resting
  68.     //
  69.     if ($forceFactorySettings || !`optionVar -exists jiggleEnableOnlyIfResting`) {
  70.         optionVar -intValue jiggleEnableOnlyIfResting 0;
  71.     }
  72.  
  73.     // default options common to all deformers
  74.     //
  75.     if ($forceFactorySettings || !`optionVar -exists jigglePositioning`) {
  76.         optionVar -stringValue jigglePositioning "default";
  77.     }
  78.     if ($forceFactorySettings || !`optionVar -exists jiggleExclusive`) {
  79.         // 0 == no exclusive
  80.         // 1 == exclusive with new name
  81.         // 2 == exclusive using an existing partition
  82.         //
  83.         optionVar -intValue jiggleExclusive 0;
  84.     }
  85.     if ($forceFactorySettings || !`optionVar -exists jiggleExclName`) {
  86.         optionVar -stringValue jiggleExclName "deformPartition";
  87.     }
  88. }
  89.  
  90. //
  91. //  Procedure Name:
  92. //      jiggleSetup
  93. //
  94. //  Description:
  95. //        Update the state of the option box UI to reflect the option values.
  96. //
  97. //  Input Arguments:
  98. //      parent               - Top level parent layout of the option box UI.
  99. //                             Required so that UI object names can be 
  100. //                             successfully resolved.
  101. //
  102. //        forceFactorySettings - Whether the option values should be set to
  103. //                             default values.
  104. //
  105. //      tabIndex             - 0 = both tabs, 1 = basic, 2 = advanced
  106. //
  107. //  Return Value:
  108. //      None.
  109. //
  110. global proc jiggleSetup(string $parent,
  111.                       int $forceFactorySettings,
  112.                       int $tabIndex)
  113. {
  114.     //    Retrieve the option settings
  115.     //
  116.     setOptionVars($forceFactorySettings);
  117.  
  118.     setParent $parent;
  119.  
  120.     //    Query the optionVar's and set the values into the controls.
  121.     //
  122.     if ($tabIndex != 2) {
  123.         //    min.
  124.         //
  125.         if (`floatSliderGrp -exists jiggleStiffness`) {
  126.             floatSliderGrp -edit 
  127.                 -value `optionVar -query jiggleStiffness`
  128.                 jiggleStiffness;
  129.         }
  130.         
  131.         //    max.
  132.         //
  133.         if (`floatSliderGrp -exists jiggleDamping`) {
  134.             floatSliderGrp -edit 
  135.                 -value `optionVar -query jiggleDamping`
  136.                 jiggleDamping;
  137.         }
  138.         
  139.         //    curvature.
  140.         //
  141.         if (`floatSliderGrp -exists jiggleWeight`) {
  142.             floatSliderGrp -edit 
  143.                 -value `optionVar -query jiggleWeight`
  144.                 jiggleWeight;
  145.         }
  146.  
  147.         if (`checkBoxGrp -exists jiggleEnableOnlyIfRestingWidget`) {
  148.             checkBoxGrp -e -v1 `optionVar -query jiggleEnableOnlyIfResting`  jiggleEnableOnlyIfRestingWidget;
  149.         }
  150.  
  151.         if (`checkBoxGrp -exists jiggleIgnoreTWidget`) {
  152.             checkBoxGrp -e -v1 `optionVar -query jiggleIgnoreTransform` jiggleIgnoreTWidget;
  153.         }
  154.     }
  155.  
  156.     if ($tabIndex != 1) {
  157.         // Positioning of the jiggle deformer in the DG
  158.         //
  159.         string $positioning = `optionVar -query jigglePositioning`;
  160.         if (`optionMenuGrp -exists jigglePositioningWidget`) {
  161.             if ($positioning == "default") {
  162.                 optionMenuGrp -edit -select 1 jigglePositioningWidget;
  163.             }
  164.             else if ($positioning == "before") {
  165.                 optionMenuGrp -edit -select 2 jigglePositioningWidget;
  166.             }
  167.             else if ($positioning == "after") {
  168.                 optionMenuGrp -edit -select 3 jigglePositioningWidget;
  169.             }
  170.             else if ($positioning == "split") {
  171.                 optionMenuGrp -edit -select 4 jigglePositioningWidget;
  172.             }
  173.             else if ($positioning == "parallel") {
  174.                 optionMenuGrp -edit -select 5 jigglePositioningWidget;
  175.             }
  176.             else {
  177.                 optionMenuGrp -edit -select 1 jigglePositioningWidget;
  178.             }
  179.         }
  180.         
  181.         int $exc=`optionVar -query jiggleExclusive`;
  182.         if (`checkBoxGrp -exists exclWidget`) {
  183.             checkBoxGrp -e -v1 $exc exclWidget;
  184.         }
  185.         string $exn=`optionVar -query jiggleExclName`;
  186.         if (`textFieldGrp -exists partitionNameWidget`) {
  187.             textFieldGrp -e -tx $exn -enable $exc partitionNameWidget;
  188.         }
  189.         if (`optionMenuGrp -exists partitionListWidget`) {
  190.             optionMenuGrp -e  -enable $exc partitionListWidget;
  191.         }
  192.     }
  193. }
  194.     
  195. //
  196. //  Procedure Name:
  197. //      jiggleCallback
  198. //
  199. //  Description:
  200. //        Update the option values with the current state of the option box UI.
  201. //
  202. //  Input Arguments:
  203. //      parent - Top level parent layout of the option box UI.  Required so
  204. //               that UI object names can be successfully resolved.
  205. //
  206. //        doIt   - Whether the command should execute.
  207. //
  208. //  Return Value:
  209. //      None.
  210. //
  211. global proc jiggleCallback(string $parent, int $doIt)
  212. {
  213.     //    Set the optionVar's from the control values, and then
  214.     //    perform the command.
  215.  
  216.     //    stiffness
  217.     //
  218.     if (`floatSliderGrp -exists jiggleStiffness`) {
  219.         optionVar -floatValue jiggleStiffness        
  220.             `floatSliderGrp -query -value jiggleStiffness`;
  221.     }
  222.  
  223.     //    damping
  224.     //
  225.     if (`floatSliderGrp -exists jiggleDamping`) {
  226.         optionVar -floatValue jiggleDamping        
  227.             `floatSliderGrp -query -value jiggleDamping`;
  228.     }
  229.  
  230.     //    Curvature.
  231.     //
  232.     if (`floatSliderGrp -exists jiggleWeight`) {
  233.         optionVar -floatValue jiggleWeight        
  234.             `floatSliderGrp -query -value jiggleWeight`;
  235.     }
  236.  
  237.     if (`checkBoxGrp -exists jiggleEnableOnlyIfRestingWidget`) {
  238.         optionVar -intValue jiggleEnableOnlyIfResting `checkBoxGrp -q -v1 jiggleEnableOnlyIfRestingWidget`;
  239.     }
  240.     
  241.     if (`checkBoxGrp -exists jiggleIgnoreTWidget`) {
  242.         optionVar -intValue jiggleIgnoreTransform `checkBoxGrp -q -v1 jiggleIgnoreTWidget`;
  243.     }
  244.     
  245.     
  246.     // Positioning of the jiggle deformer in the DG
  247.     //
  248.     string $positioning = "default";
  249.     if (`optionMenuGrp -exists jigglePositioningWidget`) {
  250.         if (`optionMenuGrp -query -select jigglePositioningWidget` == 1) {
  251.             $positioning = "default";
  252.         }
  253.         else if (`optionMenuGrp -query -select jigglePositioningWidget` == 2){
  254.             $positioning = "before";
  255.         }
  256.         else if (`optionMenuGrp -query -select jigglePositioningWidget` == 3){
  257.             $positioning = "after";
  258.         }
  259.         else if (`optionMenuGrp -query -select jigglePositioningWidget` == 4){
  260.             $positioning = "split";
  261.         }
  262.         else if (`optionMenuGrp -query -select jigglePositioningWidget` == 5){
  263.             $positioning = "parallel";
  264.         }
  265.     }
  266.     optionVar -stringValue jigglePositioning $positioning;
  267.  
  268.     if (`checkBoxGrp -exists exclWidget`) {
  269.         optionVar -intValue jiggleExclusive `checkBoxGrp -q -v1 exclWidget`;
  270.     }
  271.     if (`optionMenuGrp -exists partitionListWidget`) {
  272.         string $partitionNameVal = `optionMenuGrp -q -v partitionListWidget`;
  273.         if ($partitionNameVal == "Create New Partition") {
  274.             if (`textFieldGrp -exists partitionNameWidget`) {
  275.                 $partitionNameVal = `textFieldGrp -q -tx partitionNameWidget`;
  276.             }
  277.         } else {
  278.             // a value of 2 indicates that we use an existing partition
  279.             //
  280.             optionVar -intValue jiggleExclusive 2;
  281.         }
  282.         
  283.         optionVar -stringValue jiggleExclName $partitionNameVal;
  284.     }
  285.     
  286.     if ($doIt) {
  287.         performJiggle 0; 
  288.         addToRecentCommandQueue "performJiggle 0" "Jiggle";
  289.     }
  290. }
  291.  
  292.  
  293. //
  294. //  Procedure Name:
  295. //      createJiggleTabUI
  296. //
  297. //  Description:
  298. //        Create the tab UI.  The contents of each tab are created only 
  299. //        when it is required, ie. if the tab is initially visible or 
  300. //        if the tab is selected by the user.
  301. //
  302. //  Input Arguments:
  303. //      The name of the tab layout.
  304. //
  305. //  Return Value:
  306. //      None.
  307. //
  308. global proc createJiggleTabUI(string $tabLayout)
  309. {
  310.     string $tab[] = `tabLayout -query -childArray $tabLayout`;
  311.     int $currentTabIndex = `tabLayout -query -selectTabIndex $tabLayout`;
  312.  
  313.     //    Determine if the UI for this tab has been created yet.
  314.     //    This is accomplished by querying the number of children
  315.     //    in the current tab.  If the tab has no children then the UI
  316.     //    must be created.
  317.     //
  318.     if (0 == `columnLayout -query -numberOfChildren $tab[$currentTabIndex-1]`) {
  319.         setParent $tab[$currentTabIndex-1];
  320.  
  321.         string $label;
  322.         int $index;
  323.  
  324.         //    Activate the default UI template so that the layout of this 
  325.         //    option box is consistent with the layout of the rest of the 
  326.         //    application.
  327.         //
  328.         setUITemplate -pushTemplate DefaultTemplate;
  329.  
  330.         //    Turn on the wait cursor.
  331.         //
  332.         waitCursor -state 1;
  333.  
  334.         //    The current tab has no children.  Determine which tab is
  335.         //    active and create its UI.
  336.         //
  337.         //    RECOMMENDATION:  Use the 'Grp' commands where possible because
  338.         //    they obey the formatting specified in the default template.
  339.         //    This will result in a more consistent look throughout the
  340.         //    application.
  341.         //    
  342.         if (1 == $currentTabIndex) {
  343.  
  344.             //    Create UI for the first tab.
  345.             //
  346.             floatSliderGrp -label "Stiffness" -minValue 0.0 -maxValue 1.0 jiggleStiffness;
  347.  
  348.             floatSliderGrp -label "Damping" -minValue 0.0 -maxValue 1.0 jiggleDamping;
  349.  
  350.             floatSliderGrp -label "Weight" -minValue 0.0 -maxValue 1.0 jiggleWeight;
  351.  
  352.             checkBoxGrp
  353.                 -label ""
  354.                 -label1 "Jiggle Only When Object Stops"
  355.                 -annotation "When checked, the jiggle will only act if the object is stationary."
  356.                 -numberOfCheckBoxes 1
  357.                 jiggleEnableOnlyIfRestingWidget;
  358.  
  359.             checkBoxGrp
  360.                 -label ""
  361.                 -label1 "Ignore Transform"
  362.                 -annotation "When checked, the jiggle will be based only on cv motions, not object transformations."
  363.                 -numberOfCheckBoxes 1
  364.                 jiggleIgnoreTWidget;
  365.             
  366.             setParent ..;
  367.         } else if (2 == $currentTabIndex) {
  368.             
  369.             //    Create UI for the second tab.
  370.             //
  371.             columnLayout -adjustableColumn true;
  372.  
  373.             // Positioning of the jiggle deformer in the DG
  374.             optionMenuGrp -label "Deformation Order" jigglePositioningWidget;
  375.             menuItem -label "Default"       jigglePosItem1;
  376.             menuItem -label "Before"        jigglePosItem2;
  377.             menuItem -label "After"         jigglePosItem3;
  378.             menuItem -label "Split"         jigglePosItem4;
  379.             menuItem -label "Parallel"      jigglePosItem5;
  380.  
  381.             separator;
  382.             checkBoxGrp    
  383.                 -numberOfCheckBoxes 1
  384.                 -label ""
  385.                 -label1 "Exclusive"
  386.                 -v1 0 
  387.                 -on1 "optionMenuGrp -e -enable 1 partitionListWidget; updatePartitionNameWidget;"
  388.                 -offCommand "optionMenuGrp -e -enable 0 partitionListWidget; updatePartitionNameWidget;"
  389.                 exclWidget;
  390.  
  391.  
  392.             // Create an option menu listing the partitions
  393.             //
  394.             optionMenuGrp -l "Partition to Use" -enable `checkBoxGrp -q -v1 exclWidget`
  395.                 -cc "updatePartitionNameWidget" partitionListWidget;
  396.  
  397.             string $currentNameOption = "";
  398.             if (`optionVar -exists jiggleExclName`) {
  399.                 $currentNameOption = `optionVar -q jiggleExclName`;
  400.             }
  401.             
  402.             // add all the partitions to the menu
  403.             //
  404.             int $pp;
  405.             string $partitionArray[];
  406.             $partitionArray = `ls -type partition`;
  407.             int $partitionCount = size($partitionArray);
  408.             menuItem -l "Create New Partition";
  409.             for ($pp = 0; $pp < $partitionCount; $pp++)
  410.             {
  411.                 // Do not list the render partition as adding items to
  412.                 // it is only going to cause confusion.
  413.                 //
  414.                 if ($partitionArray[$pp] != "renderPartition" && 
  415.                     $partitionArray[$pp] != "characterPartition") {
  416.                     menuItem -l $partitionArray[$pp];
  417.                 }
  418.                 if ($currentNameOption == $partitionArray[$pp]) {
  419.                     optionVar -stringValue jiggleExclName "deformPartition";
  420.                 }
  421.             }
  422.  
  423.             textFieldGrp -l "New Partition Name" -enable `checkBoxGrp -q -v1 exclWidget` 
  424.                 -tx "deformPartition"
  425.                 partitionNameWidget;
  426.         
  427.             updatePartitionNameWidget;
  428.         }
  429.  
  430.         //    Update the control values to match the options.
  431.         //
  432.         eval (("jiggleSetup " + $tabLayout + " "+0+" "+$currentTabIndex));
  433.     
  434.         //    Turn off the wait cursor.
  435.         //
  436.         waitCursor -state 0;
  437.         
  438.         //    Deactivate the default UI template.
  439.         //
  440.         setUITemplate -popTemplate;
  441.     }
  442. }
  443.  
  444. //
  445. //  Procedure Name:
  446. //      jiggleOptions
  447. //
  448. //  Description:
  449. //        Construct the option box UI.  Involves accessing the standard option
  450. //        box and customizing the UI accordingly.
  451. //
  452. //  Input Arguments:
  453. //      None.
  454. //
  455. //  Return Value:
  456. //      None.
  457. //
  458. // ********* Change 'jiggle' in this proc to be the name of your command
  459. proc jiggleOptions()
  460. {
  461.     //    Name of the command for this option box.
  462.     //
  463.     string $commandName = "deformer";
  464.  
  465.     //    Build the option box actions.
  466.     //
  467.     string $callback = ("jiggleCallback");
  468.     string $setup = ("jiggleSetup");
  469.  
  470.     //    STEP 1:  Get the option box.
  471.     //    ============================
  472.     //
  473.     //  The value returned is the name of the layout to be used as
  474.     //    the parent for the option box UI.
  475.     //
  476.     string $layout = getOptionBox();
  477.     setParent $layout;
  478.     
  479.     //    STEP 2:  Pass the command name to the option box.
  480.     //    =================================================
  481.     //
  482.     //    Any default option box behaviour based on the command name is set 
  483.     //    up with this call.  For example, updating the 'Help' menu item with
  484.     //    the name of the command.
  485.     //
  486.     setOptionBoxCommandName($commandName);
  487.  
  488.     //    STEP 3:  Activate the default UI template.
  489.     //    ==========================================
  490.     //
  491.     //    Activate the default UI template so that the layout of this 
  492.     //    option box is consistent with the layout of the rest of the 
  493.     //    application.
  494.     //
  495.     //    Note: this option box example delays the creation of the UI
  496.     //    until it's required.  Therefore this step is moved to the
  497.     //    procedure where the UI is actually created. 
  498.     //
  499.     //setUITemplate -pushTemplate DefaultTemplate;
  500.  
  501.     //    STEP 4: Create option box contents.
  502.     //    ===================================
  503.     //    
  504.     //    This, of course, will vary from option box to option box.    
  505.     
  506.     //    Demonstrate the delaying of UI creation via tab layouts.
  507.     //    Instead of creating all of the option box UI initially, only
  508.     //    create that which is initially visible.  Wait, until the 
  509.     //    other tabs are selected to create the remaining UI.
  510.     //
  511.     string $tabLayout = `tabLayout -scrollable 1`;
  512.  
  513.     //    Attach an action that will be invoked before a tab is selected.
  514.     //    
  515.     tabLayout -edit 
  516.         -preSelectCommand ("createJiggleTabUI " + $tabLayout)
  517.         $tabLayout;
  518.  
  519.     //    Create just the immediate children of the tab layout so that
  520.     //    the tabs appear.
  521.     //
  522.     columnLayout;
  523.         setParent ..;
  524.     columnLayout;
  525.         setParent ..;
  526.     
  527.     //    Set the tab labels.
  528.     //
  529.     tabLayout -edit
  530.         -tabLabelIndex 1 "Basic"
  531.         -tabLabelIndex 2 "Advanced"
  532.         $tabLayout;
  533.  
  534.     //    Create the UI for the tab that is initially visible.
  535.     //
  536.     createJiggleTabUI($tabLayout);
  537.  
  538.     //    Step 5: Deactivate the default UI template.
  539.     //  ===========================================
  540.     //
  541.     //    Note: this option box example delays the creation of the UI
  542.     //    until it's required.  Therefore this step is moved to the
  543.     //    procedure where the UI is actually created.
  544.     //
  545.     //    See also Step 2. 
  546.     //
  547.     //setUITemplate -popTemplate;
  548.  
  549.     //    Step 6: Customize the buttons.  
  550.     //    ==============================
  551.     //
  552.     //    Provide more descriptive labels for the buttons.  This is not 
  553.     //    necessary, but in some cases, for example, a button labelled 
  554.     //    'Create' may be more meaningful to the user than one labelled
  555.     //    'Apply'.
  556.     //
  557.     //  Disable those buttons that are not applicable to the option box.
  558.     //
  559.     //    Attach actions to those buttons that are applicable to the option
  560.     //    box.  Note that the 'Close' button has a default action attached 
  561.     //    to it that will hide the window.  If a a custom action is
  562.     //    attached to the 'Close' button then be sure to call the 'hide the
  563.     //    option box' procedure within the custom action so that the option
  564.     //    box is hidden properly.
  565.  
  566.     //    'Apply' button.
  567.     //
  568.     string $applyBtn = getOptionBoxApplyBtn();
  569.     button -edit
  570.         -label "Create"
  571.         -command ($callback + " " + $tabLayout + " " + 1)
  572.         $applyBtn;
  573.  
  574.     //    'Save' button.
  575.     //
  576.     string $saveBtn = getOptionBoxSaveBtn();
  577.     button -edit 
  578.         -command ($callback + " " + $tabLayout + " " + 0 + "; hideOptionBox")
  579.         $saveBtn;
  580.  
  581.     //    'Reset' button.
  582.     //
  583.     string $resetBtn = getOptionBoxResetBtn();
  584.     button -edit 
  585.         -command ($setup + " " + $tabLayout + " " + 1 + " " + 0)
  586.         $resetBtn;
  587.  
  588.     //    Step 7: Set the option box title.
  589.     //    =================================
  590.     //
  591.     setOptionBoxTitle("Create Jiggle Deformer Options");
  592.  
  593.     //    Step 8: Customize the 'Help' menu item text.
  594.     //    ============================================
  595.     //
  596.     setOptionBoxHelpTag( "CreateJiggleDeformer" );
  597.  
  598.     //    Step 9: Set the current values of the option box.
  599.     //    =================================================
  600.     //
  601.     //    NOTE:  Can not do this here since we do not know what UI is
  602.     //    currently visible.  This is moved to where the UI is created.
  603.     //
  604.     //eval (($setup + " " + $tabLayout + " " + 0));    
  605.     
  606.     //    Step 10: Show the option box.
  607.     //    =============================
  608.     //
  609.     showOptionBox();
  610. }
  611.  
  612. //
  613. //  Procedure Name:
  614. //      optionBoxExample1Help
  615. //
  616. //  Description:
  617. //        Return a short description about this command.
  618. //
  619. //  Input Arguments:
  620. //      None.
  621. //
  622. //  Return Value:
  623. //      string.
  624. //
  625. proc string jiggleHelp()
  626. {
  627.     return 
  628.     "  Command: jiggle - creates a jiggle\n" +
  629.     "Selection: Deformable geometry.";    
  630. }
  631.  
  632. proc string assembleCmd()
  633. {
  634.     float $stiffness = `optionVar -query jiggleStiffness`;
  635.     float $damping = `optionVar -query jiggleDamping`;
  636.     float $weight = `optionVar -query jiggleWeight`;
  637.     int $ignoreTransform = `optionVar -query jiggleIgnoreTransform`;
  638.     int $ifResting = `optionVar -query jiggleEnableOnlyIfResting`;
  639.     string $positioning = `optionVar -query jigglePositioning`;
  640.     int $exc=`optionVar -query jiggleExclusive`;
  641.     string $exn;
  642.  
  643.     if ($exc) {
  644.         $exn=`optionVar -query jiggleExclName`;
  645.         if ($exn!="") {
  646.             // make sure that we do not clash names with an existing
  647.             // partition when the user requested a new partition, even
  648.             // if the user may have entered a non-unique name
  649.             //
  650.             if ($exc == 1)     $exn += "#";
  651.         }
  652.     }
  653.     
  654.     string $cmd = "doJiggle 1 { " +
  655.                 "\"" + $stiffness + "\", " +
  656.                 "\"" + $damping + "\", " +
  657.                 "\"" + $weight + "\", " +
  658.                 "\"" + $ignoreTransform + "\", " +
  659.                 "\"" + $ifResting + "\", " +
  660.                 "\"" + $positioning + "\", " +
  661.                 "\"" + $exn + "\"" +                        
  662.             " };";
  663.  
  664.  
  665.     return $cmd;
  666. }
  667.  
  668.  
  669. //
  670. //  Procedure Name:
  671. //      performJiggle
  672. //
  673. //  Description:
  674. //        Perform the jiggle command using the corresponding 
  675. //        option values.  This procedure will also show the option box
  676. //        window if necessary as well as construct the command string
  677. //        that will invoke the jiggle command with the current
  678. //        option box values.
  679. //
  680. //  Input Arguments:
  681. //      0 - Execute the command.
  682. //      1 - Show the option box dialog.
  683. //      2 - Return the command.
  684. //
  685. //  Return Value:
  686. //      None.
  687. //
  688. global proc string performJiggle(int $action)
  689. {
  690.     string $cmd = "";
  691.  
  692.     switch ($action) {
  693.  
  694.         //    Execute the command.
  695.         //
  696.         case 0:
  697.             //    Retrieve the option settings
  698.             //
  699.             setOptionVars(false);
  700.  
  701.             //    Get the command.
  702.             //
  703.             $cmd = assembleCmd();
  704.  
  705.             //    Execute the command with the option settings.
  706.             //
  707.             evalEcho($cmd);
  708.  
  709.             break;
  710.  
  711.         //    Show the option box.
  712.         //
  713.         case 1:
  714.             jiggleOptions;
  715.             break;
  716.  
  717.         //    Return the command string.
  718.         //
  719.         case 2:
  720.             //    Retrieve the option settings.
  721.             //
  722.             setOptionVars (false);
  723.  
  724.             //    Get the command.
  725.             //
  726.             $cmd = assembleCmd();
  727.             break;
  728.     }
  729.     return $cmd;
  730. }
  731.  
  732.